<?php

namespace app\common\model;



class MessageModel extends BaseModel
{

  protected $table = 'message';
  protected $pk='id';
  //开启自动写入时间戳
  protected $autoWriteTimestamp = true;
  protected  $type =[
      'create_time' => 'timestamp:Y-m-d H:i',
      'update_time' => 'timestamp:Y-m-d H:i',
  ];

  /**
   * 留言
   * @param $data
   * @return mixed
   */
  public function add($data)
  {
    return self::create($data);
  }

  /**
   * 留言
   * @param $data
   * @return mixed
   */
  public function edit($data)
  {
    return self::update($data);
  }

  /**
   * 删除字典
   * @param $id
   * @return bool
   * @throws \Exception
   */
  public function del($id)
  {

    return $this->where('id', $id)->delete();
  }
}
